package com.ken.elmboot.mapper;

import com.ken.elmboot.bean.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author ken
 */
public interface RoleMapper extends BaseMapper<Role>{
    /**
     * 新增
     *
     * @param object
     *
     * @return boolean
     */
    @Insert("insert into role(roleName) values(#{roleName})")
    public boolean add(Role object);

    /**
     * 删除
     *
     * @param id
     *
     * @return boolean
     */
    @Delete("delete from role where roleId=#{roleId}")
    public boolean deleteById(Integer id);

    /**
     * 修改
     *
     * @param object
     *
     * @return boolean
     */
    @Update("update role set roleName=#{roleName} where roleId=#{roleId}")
    public boolean edit(Role object);

    /**
     * 根据主键查询对象
     *
     *
     * @param id
     *
     * @return
     */
    @Select("select roleId,roleName from role where roleId=#{roleId}")
    public Role findById(Integer id);
}